package edu.gxmzu.task.utils;

import com.alibaba.fastjson.JSON;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

public class WebUtil {
    public static void renderString(HttpServletResponse response, Result result){
        try {
            response.setStatus(200);
            response.setContentType("application/json");
            response.setCharacterEncoding("UTF-8");
            response.getWriter().print(JSON.toJSONString(result));
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
